# -*- encoding:utf-8 -*- 
print("................开始启动图标制作..................")
content = ""
while True:
    version = str(input("请输入版本号:"))
    if version.strip() == "":
        print("版本号必填")
        continue
    name = str(input("请输入应用名:"))
    if name.strip() == "":
        print("应用名必填")
        continue
    execPath = str(input("可执行文件路径:"))
    if execPath.strip() == "":
        print("可执行文件路径必填")
        continue
    iconPath = str(input("图标路径:"))
    if execPath.strip() == "":
        print("图标路径必填")
        continue

    content = "[Desktop Entry]\nVersion=%s\nName=%s\nExec=%s\nIcon=%s\nType=Application\nCategories=Application;" % \
              (version, name, execPath, iconPath)
    print(content)
    isRight = str(input("信息是否正确？(y/n)"))
    if isRight.strip().lower() == "n":
        continue
    break

with open("/usr/share/applications/" + name + ".desktop", "w") as f:
    f.write(content)
